<template>
  <view class="in">
    <view class="in-s">
      <view
        ><text>资讯</text>
        <i class="iconfont icon-gengduo"></i>
      </view>

      <text>234条最新消息</text>
      <view class="in-tab">
        <text
          v-for="(item, index) in in_tab_list"
          :key="index"
          :class="{ 'in-is': index == in_index }"
          @click="in_qh(index)"
        >
          {{ item }}
        </text>
      </view>
    </view>
    <view class="in-x">
      <!-- in_index是0update,是1就ranking,是2就promotion-->
      <update v-if="in_index == 0"></update>
      <ranking v-if="in_index == 1"></ranking>
      <promotion v-if="in_index == 2"></promotion>
    </view>
  </view>
</template>

<script>
// 导入com文件夹下面的全部组件
import update from "./com/update";
import ranking from "./com/ranking";
import promotion from "./com/promotion";
export default {
  components: {
    update,
    ranking,
    promotion,
  },
  data() {
    return {
      src1: "/static/5.jpg",
      in_index: 1,
      in_tab_list: ["更新", "排名", "促销"],
    };
  },
  methods: {
    in_qh(index) {
      this.in_index = index;
    },
  },
};
</script>

<style lang="scss">
.in {
  display: flex;
  flex-direction: column;
  // overflow: hidden;
  height: 100vh;
}
.in-x {
  background-color: #fff;
  width: 100vw;
  display: flex;
  min-height: 90vh;
  box-sizing: border-box;
  padding: 30px;
}
.in-s {
  display: flex;
  flex-direction: column;
  padding: 30px 26px;

  > view:nth-child(1) {
    display: flex;
    justify-content: space-between;
    align-items: center;

    > text:nth-child(1) {
      font-weight: bold;
      font-size: 23px;
    }

    > i {
      font-size: 23px;
    }
  }

  > text:nth-child(2) {
    font-size: 14px;
    color: #616161;
    margin-top: 7px;
    margin-bottom: 20px;
  }

  > view:nth-child(3) {
    padding: 7px;
    box-sizing: border-box;
    background-color: #fff;
    display: flex;
    border-radius: 10px;
    box-shadow: 0px 22px 24px 0px rgba(53, 64, 90, 0.13);
    width: fit-content;
    // width: 300px;

    > text {
      padding: 9px 25px;
      border-radius: 8px;
      color: #616161;
    }
  }
}

.in-is {
  transition: all 0.6s;
  background: #f4b062;
  color: white !important;
}
</style>
